package coop.tecso.capacitaciones.threads.producer.consumer;

public class Consumidor extends Thread {

	private Buffer buffer;
	private boolean finishedOk = false;

	public Consumidor(Buffer buffer) {
		super();
		this.buffer = buffer;
	}

	@Override
	public void run() {
		try {
			int i = buffer.get();
			System.out.println("Consumido :" + i);
			finishedOk = true;
		} catch (Exception e) {
			System.out.println("Consumidor **** Exception al consumir");
			// error al obtener el producto
			// finishedOk queda en false
		}
	}

	public boolean isFinishedOk() {
		return finishedOk;
	}

}
